package com.zzy.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzy.system.domain.GuanmaiCustomerItem;
import com.zzy.system.mapper.GuanmaiCustomerItemMapper;
import com.zzy.system.service.IGuanmaiCustomerItemService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

@Service
public class GuanmaiCustomerItemServiceImpl extends ServiceImpl<GuanmaiCustomerItemMapper, GuanmaiCustomerItem> implements IGuanmaiCustomerItemService {

    private static final Logger log = LoggerFactory.getLogger(GuanmaiCustomerItemServiceImpl.class);

    @Override
    public void saveCustomerItemList(GuanmaiCustomerItem guanmaiCustomerItem) {
        if(guanmaiCustomerItem != null){
            QueryWrapper<GuanmaiCustomerItem> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("customer_id", guanmaiCustomerItem.getCustomerId());
            baseMapper.delete(queryWrapper);
            this.save(guanmaiCustomerItem);
        }

    }
}